package main

import (
	"fmt"
	"strconv"
	"strings"
)

/*
const (

	one   = 1
	two   = 2
	three = 3
	four  = 4

)
*/
const (
	one = iota + 1
	two
	three
	four
)

func main() {
	var i = 10
	i = 2

	fmt.Println(i)

	var f32 float32 = 2.3
	var f64 float64 = 10.345
	fmt.Println("f32 is", f32, ":f64 is", f64)
	var bf bool = false
	var bt bool = true
	fmt.Println("bf is ", bf, ",bt is ", bt)
	var s1 string = "hello"
	var s2 string = "世界"
	fmt.Println("s1 is ", s1, ",s2 is", s2)
	fmt.Println("s1+s2=", s1+s2)
	s1 += s2
	fmt.Println("s1+=s2=", s1)
	var zi int
	var zf float64
	var zb bool
	var zs string
	fmt.Print(zi, zf, zb, zs)
	j := 120
	bf1 := false
	s12 := "Hello"
	fmt.Println(j)
	fmt.Println(j, s12, bf1)
	pi := &i
	fmt.Println(*pi)
	i = 20
	fmt.Println("i的新值是", i)

	fmt.Println(one, two, three, four)

	i2s := strconv.Itoa(i)
	s2i, err := strconv.Atoi(i2s)
	fmt.Println(i2s, s2i, err)
	i2f := float64(i)
	f2i := int(f64)
	fmt.Println(i2f, f2i)
	//判断s1的前缀是否是h
	fmt.Println(strings.HasPrefix(s1, "h"))
	//在s1中查找字符串o

	fmt.Println(strings.Index(s1, "o"))

	//把s1全部转为大写

	fmt.Println(strings.ToUpper(s1))
	i2 := strings.Index("飞雪无情", "22飞雪1")
	fmt.Println(i2)
}
